import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from './shared/shared.module';
import { Store } from '@ngxs/store';
import { RouterSelector } from './store/router/router.selector';
import { checkRouterActive } from './shared/utils/utils';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule, SharedModule],
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent {
  isCollapsed = false;

  constructor(private store: Store) {
  }

  checkSelected(...urls: string[]) {
    let currentUrl = this.store.selectSnapshot(RouterSelector.url);
    if (!currentUrl || !urls || urls.length === 0) return false;
    return checkRouterActive(currentUrl, urls);
  }
}
